<?
class news
{
	function GetSubcateType($sub_id){		
	 global $sql;
	 	$type ='';
			$result=$sql->query('SELECT  sub_type FROM subcat  WHERE sub_id="'.$sub_id.'"');
								
					while($k=$sql->fetch_array($result)){				
						$type = $k['sub_type'];
					}			
		return $type;
		$sql->free_result($result);						
	}
	function GetParentName($parent_id){		
	 global $sql;
	 $type	='';
			$sql->query('SELECT  parent_name FROM parent  WHERE parent_id="'.$parent_id.'"');						
					while($k=$sql->fetch_array()){				
						$type .= $k['parent_name'];
						
					}
								
		return $type;
		$sql->free_result();						
	}
	function GetParentIMG($parent_id){		
	 global $sql;
	 	 $type	='';

			$result = $sql->query('SELECT parent_img FROM parent_cat  WHERE parent_id="'.$parent_id.'"');						
					while($k=$sql->fetch_array($result)){				
						$type = $k['parent_img'];
					}			
		return $type;
		$sql->free_result();						
	}	
	
	function GetSubName($sub_id){		
	 global $sql;
	 	 	$type ='';
			$result =$sql->query('SELECT  sub_name FROM subcat  WHERE sub_id="'.$sub_id.'"');						
					while($k=$sql->fetch_array($result)){				
						$type = $k['sub_name'];
					}			
		return $type;
		$sql->free_result($result);						
	}	
	function GetSubTitle($sub_id){		
	 global $sql;
	 	 	$type ='';
			$sql->query('SELECT  parent_id, sub_id,sub_name FROM subcat  WHERE sub_id="'.$sub_id.'"');						
					while($k=$sql->fetch_array()){				
						$type = $k['sub_name'];
					}			
		return $type;
		$sql->free_result();						
	}		
	function ShowNewsTitle($news_id){		
	 global $sql;
	 	 	$type ='';
			$result = mysql_query('SELECT  news_title FROM news  WHERE news_id="'.$news_id.'"');						
					while($m=mysql_fetch_array($result)){				
						$types = $m['news_title'];
					}			
		return $types;
		mysql_free_result();						
	}	
		
	function ShowSubNews($sub_id){		
	 global $sql;
	 	 	$type ='';
			$sql->query('SELECT  subnews_name FROM subnews  WHERE subnews_id="'.$sub_id.'"');						
					while($k=$sql->fetch_array()){				
						$type = $k['subnews_name'];
					}			
		return $type;
		$sql->free_result();						
	}
	function GetLeftMenuHD(){		
	 global $sql,$pub;
	 		$str ='';
			$result	= $sql->query('SELECT * FROM parent  WHERE parent_active=1 and parent_type="3" ORDER BY parent_order DESC ');
			while($m=mysql_fetch_array($result)){
			$str.=' <ul class="left_menu ">';
				$title=$pub->CutStr($m['parent_name']);
				$link=''.PATH_HTTP.'Parent/'.$m['parent_id'].'/'.$title.'.html';
				$str .='<li class="odd"><a title="'.$m['parent_name'].'" href="'.$link.'">'.$m['parent_name'].'</a></li>';
			
				$result1	= $sql->query('SELECT * FROM subcat  WHERE parent_id='.$m['parent_id'].' ORDER BY sub_order DESC ');
				
				while($k=$sql->fetch_array($result1)){		
					$title1=$pub->CutStr($k['sub_name']);
					$link1=''.PATH_HTTP.'Sub/'.$k['parent_id'].'/'.$k['sub_id'].'/'.$title1.'.html';
					$str .='<li class="even"><a title="'.$k['sub_name'].'" href="'.$link1.'">'.$k['sub_name'].'</a></li>';
					}
					
					}
				$str.='</ul>';
			$sql->free_result($result);
			$sql->free_result($result1);
		return $str;
	}	
	function GetLeftMenuDC($sub_id){		
	 global $sql,$pub;
	 		$str ='';
			$result	= $sql->query('SELECT * FROM parent  WHERE parent_active=1 and parent_type="5" ORDER BY parent_order DESC ');
			while($m=mysql_fetch_array($result)){
			$str.=' <ul class="left_menu ">';
				$title=$pub->CutStr($m['parent_name']);
				$link=''.PATH_HTTP.'Parent/'.$m['parent_id'].'/'.$title.'.html';
				$str .='<li class="odd"><a title="'.$m['parent_name'].'" href="'.$link.'">'.$m['parent_name'].'</a></li>';
			if($sub_id==$m['parent_id']){
				$result1	= $sql->query('SELECT * FROM subcat  WHERE parent_id='.$m['parent_id'].' ORDER BY sub_order DESC ');
				
				while($k=$sql->fetch_array($result1)){		
					$title1=$pub->CutStr($k['sub_name']);
					$link1=''.PATH_HTTP.'Sub/'.$k['parent_id'].'/'.$k['sub_id'].'/'.$title1.'.html';
					$str .='<li class="even"><a title="'.$k['sub_name'].'" href="'.$link1.'">'.$k['sub_name'].'</a></li>';
					}
					}
					}
				$str.='</ul>';
			$sql->free_result($result);
			$sql->free_result($result1);
		return $str;
	}	
	function GetLeftMenuMovie(){		
	 global $sql,$pub;
	 		$str ='';
			$result	= $sql->query('SELECT * FROM parent  WHERE parent_active=1 and parent_type=4 ORDER BY parent_order DESC ');
			while($m=mysql_fetch_array($result)){
				
				$str.=' <ul class="left_menu ">';
				
				$str .='<li class="odd"><a title="'.$m['parent_name'].'" href="#">'.$m['parent_name'].'</a></li>';
				$result1	= $sql->query('SELECT * FROM subcat  WHERE parent_id='.$m['parent_id'].' ORDER BY sub_order DESC ');
				while($k=$sql->fetch_array($result1)){		
					$title1=$pub->CutStr($k['sub_name']);
					$link1=''.PATH_HTTP.'Sub_Movie/'.$k['parent_id'].'/'.$k['sub_id'].'/'.$title1.'.html';
					$str .='<li class="even"><a title="'.$k['sub_name'].'" href="'.$link1.'">'.$k['sub_name'].'</a></li>';
					}		
					}
					
				$str.='</ul>';
			$sql->free_result($result);
			$sql->free_result($result1);
		return $str;
	}	

	function ShowSubCate($sub_id){		
	 global $sql;
	 		$str ='';
			$slt = 'parent_id,sub_id,sub_name';
			$query	= $sql->query('SELECT '.$slt.' FROM subcate WHERE sub_id="'.$sub_id.'"  limit 1');						
				$i  = 1;
					while($k=$sql->fetch_array($query)){				
						$str .= '&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href="?cc='.encode_all('m0=product&m1='.$k['parent_id'].'&m2='.$k['sub_id'].'&m3=&m4=list').'" class="linksp"><b>'.$k['sub_name'].'</b></a>';							
					}			
		return $str;
		$sql->free_result(query);						
	}	
	function ShowSubNewsCate($sub_id){		
	 global $sql;
	 		$str ='';
			$slt = 'subnews_id,subnews_name';
			$query	= $sql->query('SELECT '.$slt.' FROM subnews WHERE subnews_id="'.$sub_id.'"  limit 1');						
				$i  = 1;
					while($k=$sql->fetch_array($query)){				
						$str .= '&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<b>'.$k['subnews_name'].'</b></a>';							
					}			
		return $str;
		$sql->free_result(query);						
	}		
	
	function GetMovieList($cat_id,$sub_id,$dk,$width,$height,$maxrows,$columns){
		global $sql,$pub;
				
		$show = '';
		$p = isset($_REQUEST['curpg']) ? $_REQUEST['curpg'] : 1;
		$slt = "*";
			if($dk=="1"){
			if($_REQUEST['search']!=""){				
				$mcat_id = $_REQUEST['cat_id'];
				$msub_id = $_REQUEST['sub_id'];
				$title	 = $_REQUEST['title'];
				$year1   = $_REQUEST['year1'];
				$year2   = $_REQUEST['year2'];				
					if(($mcat_id!="")&&($msub_id!="")&&($title!="")&&($year2!="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="'.$mcat_id.'" AND sub_id="'.$msub_id.'" AND mv_name LIKE "%'.$title.'%" AND mv_year>='.$year1.' AND mv_year<='.$year2.' AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}		
					if(($mcat_id=="0")&&($msub_id!="")&&($title!="")&&($year2!="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  sub_id="'.$msub_id.'" AND mv_name LIKE "%'.$title.'%" AND mv_year>='.$year1.' AND mv_year<='.$year2.' AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}							
					if(($mcat_id=="0")&&($msub_id=="0")&&($title!="")&&($year2!="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  mv_name LIKE "%'.$title.'%"  AND mv_year>='.$year1.' AND mv_year<='.$year2.' AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}												
					if(($mcat_id=="0")&&($msub_id=="0")&&($title=="")&&($year2!="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE    mv_year>='.$year1.' AND mv_year<='.$year2.' AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}	
					if(($mcat_id!="0")&&($msub_id!="0")&&($title=="")&&($year2!="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="'.$mcat_id.'" AND sub_id="'.$msub_id.'"  AND  mv_year>='.$year1.' AND mv_year<='.$year2.' AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}																						
					if(($mcat_id!="0")&&($msub_id!="0")&&($title=="")&&($year2=="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="'.$mcat_id.'" AND sub_id="'.$msub_id.'"  AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}	
					if(($mcat_id=="0")&&($msub_id=="0")&&($title!="")&&($year2=="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE mv_name LIKE "%'.$title.'%"  AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}		
					if(($mcat_id!="0")&&($msub_id=="0")&&($title=="")&&($year2=="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="'.$mcat_id.'" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}												
				}else{
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  mv_active="1"   ORDER BY mv_dateadd DESC  ');												
				}	
			}
			if($dk=="3"){
				if($_REQUEST['search']!=""){				
				$mcat_id = $_REQUEST['cat_id'];
				$msub_id	 = $_REQUEST['sub_id'];
				$title	 = $_REQUEST['title'];
				$year1   = $_REQUEST['year1'];
				$year2   = $_REQUEST['year2'];				
					if(($mcat_id!="")&&($msub_id!="")&&($title!="")&&($year2!="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="'.$mcat_id.'" AND sub_id="'.$msub_id.'" AND mv_name LIKE "%'.$title.'%" AND mv_year>='.$year1.' AND mv_year<='.$year2.' AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}		
					if(($mcat_id=="0")&&($msub_id!="")&&($title!="")&&($year2!="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  sub_id="'.$msub_id.'" AND mv_name LIKE "%'.$title.'%" AND mv_year>='.$year1.' AND mv_year<='.$year2.' AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}							
					if(($mcat_id=="0")&&($msub_id=="0")&&($title!="")&&($year2!="")){						
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  mv_name LIKE "%'.$title.'%"  AND mv_year>='.$year1.' AND mv_year<='.$year2.' AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}												
					if(($mcat_id=="0")&&($msub_id=="0")&&($title=="")&&($year2!="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE    mv_year>='.$year1.' AND mv_year<='.$year2.' AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}	
					if(($mcat_id!="0")&&($msub_id!="0")&&($title=="")&&($year2!="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="'.$mcat_id.'" AND sub_id="'.$msub_id.'"  AND  mv_year>='.$year1.' AND mv_year<='.$year2.' AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}																						
					if(($mcat_id!="0")&&($msub_id!="0")&&($title=="")&&($year2=="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="'.$mcat_id.'" AND sub_id="'.$msub_id.'"  AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}	
					if(($mcat_id=="0")&&($msub_id=="0")&&($title!="")&&($year2=="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE mv_name LIKE "%'.$title.'%"  AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}		
					if(($mcat_id!="0")&&($msub_id=="0")&&($title=="")&&($year2=="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="'.$mcat_id.'" AND mv_active="1"   ORDER BY mv_dateadd DESC ');												
					}			
				}else{
					if(($cat_id!="")&&($sub_id!="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="'.$cat_id.'" AND sub_id="'.$sub_id.'" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}if(($cat_id!="")&&($sub_id=="")){
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="'.$cat_id.'" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
					}				
				
				}
			}	
			// shenlong2210 chen vao day null la ""; tất cả là "0";
				// PHIM MỚI ID:17
				if($_REQUEST['search2']!="")
				{
					$mcat_id = "17";
					$msub_id = "0";
					$title	 = "";
					$year1   = "";
					$year2   = "";				
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="'.$mcat_id.'" AND mv_active="1"   ORDER BY mv_dateadd DESC ');												
				}
				//===============================================================
				// PHIM 3D TIVI ID:18
				if($_REQUEST['search3']!="")
				{				
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="18" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
				}
				// PHIM 3D TIVI - hành động ID:18-67
				if($_REQUEST['search31']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="18" AND sub_id="67" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
				}
				// PHIM 3D TIVI - hoạt hình ID:18-68
				if($_REQUEST['search32']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="18" AND sub_id="68" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
				}
				// PHIM 3D TIVI - kinh dị ID:18-69
				if($_REQUEST['search33']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="18" AND sub_id="69" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
				}
				// PHIM 3D TIVI - phiêu lưu ID:18-70
				if($_REQUEST['search34']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="18" AND sub_id="70" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
				}
				// PHIM 3D TIVI - ca nhạc 3D ID:18-71
				if($_REQUEST['search35']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="18" AND sub_id="71" AND mv_active="1"   ORDER BY mv_dateadd DESC ');												
				}
				// PHIM 3D TIVI - clip 3D ID:18-72
				if($_REQUEST['search36']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="18" AND sub_id="72" AND mv_active="1"   ORDER BY mv_dateadd DESC ');												
				}
				
				
				//===============================================================
				// PHIM LẺ HD ID:6
				if($_REQUEST['search4']!="")
				{
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="6" AND mv_active="1"   ORDER BY mv_dateadd DESC ');												
					
				}
				// PHIM LẺ HD - PHIÊU LƯU ID:6-17
				if($_REQUEST['search41']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="6" AND sub_id="17" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				// PHIM LẺ HD - HÀNH ĐỘNG ID:6-16
				if($_REQUEST['search42']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="6" AND sub_id="16" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				// PHIM LẺ HD - VÕ THUẬT ID:6-20
				if($_REQUEST['search43']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="6" AND sub_id="20" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				// PHIM LẺ HD - Kinh dị ID:6-19
				if($_REQUEST['search44']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="6" AND sub_id="19" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				// PHIM LẺ HD - Hài ID:6-18
				if($_REQUEST['search45']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="6" AND sub_id="18" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				// PHIM LẺ HD - Tình cảm ID:6-95
				if($_REQUEST['search46']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="6" AND sub_id="95" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				// PHIM LẺ HD - Châu Á ID:6-96
				if($_REQUEST['search47']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="6" AND sub_id="96" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				// PHIM LẺ HD - Chiến tranh ID:6-97
				if($_REQUEST['search48']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="6" AND sub_id="97" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				// PHIM LẺ HD - Hoạt hình ID:6-98
				if($_REQUEST['search49']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="6" AND sub_id="98" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				// PHIM LẺ HD - Việt Nam ID:6-99
				if($_REQUEST['search410']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="6" AND sub_id="99" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				// PHIM LẺ HD - Cải lương ID:6-100
				if($_REQUEST['search411']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="6" AND sub_id="100" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				// PHIM LẺ HD - Bluray ID:6-101
				if($_REQUEST['search412']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="6" AND sub_id="101" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				
				//===============================================================
				// PHIM BỘ ID:7
				if($_REQUEST['search5']!="")
			{
				$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="7" AND mv_active="1"   ORDER BY mv_dateadd DESC ');												
			}
				// PHIM BỘ ID - phim Hồng kông: 7-22
				if($_REQUEST['search51']!="")
					{			
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="7" AND sub_id="22" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
					}
				// PHIM BỘ ID - phim Hàn Quốc: 7-73
				if($_REQUEST['search52']!="")
					{			
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="7" AND sub_id="73" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
					}
				// PHIM BỘ ID - phim Mỹ: 7-21
				if($_REQUEST['search53']!="")
					{			
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="7" AND sub_id="21" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
					}
				// PHIM BỘ ID - phim Việt Nam: 7-102
				if($_REQUEST['search54']!="")
					{			
						$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="7" AND sub_id="102" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
					}
			
			
			
			//===============================================================
				// CA NHẠC HÀI ID:9
			if($_REQUEST['search6']!="")
			{
				$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="9" AND mv_active="1"   ORDER BY mv_dateadd DESC ');												
			}
			// CA NHẠC HÀI - liveshow: 9-23
				if($_REQUEST['search61']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="9" AND sub_id="23" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
			// CA NHẠC HÀI - Thuý Nga: 9-24
				if($_REQUEST['search62']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="9" AND sub_id="24" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
			// CA NHẠC HÀI - Asia: 9-74
				if($_REQUEST['search63']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="9" AND sub_id="74" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
			// CA NHẠC HÀI - Vân Sơn: 9-75
				if($_REQUEST['search64']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="9" AND sub_id="75" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
			// CA NHẠC HÀI - Hàn Quốc: 9-76
				if($_REQUEST['search65']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="9" AND sub_id="76" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
			// CA NHẠC HÀI - Việt Nam: 9-77
				if($_REQUEST['search66']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="9" AND sub_id="77" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
			// CA NHẠC HÀI - KaraOke: 9-78
				if($_REQUEST['search67']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="9" AND sub_id="78" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}	
			// CA NHẠC HÀI - Hài Vân Sơn: 9-79
				if($_REQUEST['search68']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="9" AND sub_id="79" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
			// CA NHẠC HÀI - Hài Hoài Linh: 9-80
				if($_REQUEST['search69']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="9" AND sub_id="80" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
			// CA NHẠC HÀI - Lossless: 9-81
				if($_REQUEST['search610']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="9" AND sub_id="81" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
			
			//===============================================================
				// DOCUMENTS ID:8
			if($_REQUEST['search7']!="")
			{
				$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="8" AND mv_active="1"   ORDER BY mv_dateadd DESC ');												
			}
				// DOCUMENT - học tập: 8-33
				if($_REQUEST['search71']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="8" AND sub_id="33" AND mv_active="1"   ORDER BY mv_dateadd DESC ');													
				}
				// DOCUMENT - discovery: 8-82
				if($_REQUEST['search72']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="8" AND sub_id="82" AND mv_active="1"   ORDER BY mv_dateadd DESC
					');													
				}
				
				
			//===============================================================
				// TUYỂN TẬP ID:22
			if($_REQUEST['search8']!="")
			{
				$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  parent_id="22" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
			}
				// TUYỂN TẬP - 007: 22-83
				if($_REQUEST['search81']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="22" AND sub_id="83" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');													
				}	
				// TUYỂN TẬP - Châu Tình Trì: 22-84
				if($_REQUEST['search82']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="22" AND sub_id="84" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');													
				}	
				// TUYỂN TẬP - Lý Liên Kiệt: 22-85
				if($_REQUEST['search83']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="22" AND sub_id="85" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');													
				}
				// TUYỂN TẬP - Chung Từ Đơn: 22-86
				if($_REQUEST['search84']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="22" AND sub_id="86" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');													
				}		
				// TUYỂN TẬP - Thành Long: 22-87
				if($_REQUEST['search85']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="22" AND sub_id="87" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');													
				}
				// TUYỂN TẬP - Lý Tiểu Long: 22-88
				if($_REQUEST['search86']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="22" AND sub_id="88" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');													
				}
				// TUYỂN TẬP - Ấn Độ: 22-89
				if($_REQUEST['search87']!="")
				{			
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="22" AND sub_id="89" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');													
				}
			//hết
			
		if($sql->num_rows($result)>0){								
			$ttk 	 = $sql->num_rows($result);				
			$maxrow  = $maxrows; $maxpage = 4;
			$curpage = $p; $numnews = 0;
			$i=1;
			if($ttk >0) 			
			$show .= '<table width="100%" border="0"><form action="" method="post" name="frm_page" id="frm_page">
			<input type="hidden" name="curpg" value="'.$p.'">';		
			$i=1;
			while ($k=$sql->fetch_array($result)) {				
				if(($numnews >= ($curpage-1)*$maxrow) && ($numnews < ($curpage*$maxrow)) ){
				$checkadd = $pub->tmpmovie($_SESSION['hd308'],$k['id']);
					$show .='  <td bgcolor="#EFEFEF" ><div class="prod_box1">
								<div id="PP_'.$k['id'].'" onmouseover="OVER_PP('.$k['id'].');" onmouseout="OUT_PP('.$k['id'].');" onclick="AddToCart('.$k['id'].','.$k['mv_capacity'].');"  class="center_prod_box1" style="background-image:url('.PATH_HTTP.'upload_img/movie/'.$k['mv_smallimg'].');" title="'.$k['mv_name'].'" >';
								if($checkadd=="1"){								
									$show .='<div style="height:193px; width:129px" class="css_over_pp" >
									<img onload="javascript:CheckActive('.$k['id'].');" id="IMG_'.$k['id'].'" src="'.PATH_HTTP.'images/deadd.png" style="position: absolute; opacity: 1; display: block; " class="css_over_pp">
								</div>';
								}else{
									$show .='<div style="height:193px; width:129px" id="BG_'.$k['id'].'" >															
									<img onload="javascript:CheckActive('.$k['id'].');" id="IMG_'.$k['id'].'" src="'.PATH_HTTP.'images/add.jpg" style="display:none; position:absolute; FILTER: alpha(opacity=100); opacity: 1.0;" class="css_over_pp">
									</div>';
								 }             
									$show.='</div>
									<div class="movie_title" ><a href="'.PATH_HTTP.'userfiles/image/hinh%20phim/'.$k['mv_bigimg'].'"  onclick="return hs.expand(this)" class=" "><img src="'.PATH_HTTP.'image/chitiet.gif" border="0"></a></div>
									<div  style="color:blue; font-size:11px; width:140px; text-align:center;" >'.$k['mv_name_en'].'</div>
									<div class="movie_title" >'.$k['mv_name'].'</div>
									<div class="year">'.$k['mv_year'].'</div> 														 
								</div>';
								$show.='</td>';
							if($i%$columns==0)$show.='</tr>';
							if($i%$columns==0 && $i<$ttk)$show .= '';
				}
				$i++;
				$numnews++;			
			}			
			$show .= '<tr><td colspan="'.$columns.'"><div align="center" >'.$pub->paging("paging",$ttk,$curpage,$maxpage,$maxrow).'</div></td></tr></form></table>';
			}else{
				$show.="<br><br><center> Không tìm thấy sản phẩm</center><br>";
			}
			
		$sql->free_result($result);
		return $show;		
	}
	function GetMovieList2($cat_id,$sub_id,$dk,$width,$height,$maxrows,$columns){
		global $sql,$pub;
				
		$show = '';
		$p = isset($_REQUEST['curpg']) ? $_REQUEST['curpg'] : 1;
		$slt = "*";
			if($dk=="1"){
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  mv_active="1"   ORDER BY mv_dateadd DESC  ');												
			}
			if($dk=="3"){
				if(($cat_id!="")&&($sub_id!="")){
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="'.$cat_id.'" AND sub_id="'.$sub_id.'" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
				}if(($cat_id!="")&&($sub_id=="")){
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="'.$cat_id.'" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
				}				
			}						
		if($sql->num_rows($result)>0){								
			$ttk 	 = $sql->num_rows($result);				
			$maxrow  = $maxrows; $maxpage = 4;
			$curpage = $p; $numnews = 0;
			$i=1;
			if($ttk >0) 			
			$show .= '<table width="100%" border="0"><form action="" method="post" name="frm_page" id="frm_page">
			<input type="hidden" name="curpg" value="'.$p.'">';		
			$i=1;
			while ($k=$sql->fetch_array($result)) {				
				if(($numnews >= ($curpage-1)*$maxrow) && ($numnews < ($curpage*$maxrow)) ){
					$show .='  <td bgcolor="#EFEFEF" ><div class="prod_box1">
								<div id="PP_'.$k['id'].'" onmouseover="OVER_PP('.$k['id'].');" onmouseout="OUT_PP('.$k['id'].');" onclick="AddToCart('.$k['id'].','.$k['mv_capacity'].');"  class="center_prod_box1" style="background-image:url('.PATH_HTTP.'upload_img/movie/'.$k['mv_smallimg'].');" title="'.$k['mv_name'].'" >
								
								<div style="height:193px; width:129px" id="BG_'.$k['id'].'" >
								<img onload="javascript:CheckActive('.$k['id'].');" id="IMG_'.$k['id'].'" src="'.PATH_HTTP.'image/add.jpg" style="position: absolute; opacity: 1; display: block; ">
								</div></div>';
								              
									$show.='
									<div class="movie_title" ><a href="'.PATH_HTTP.'userfiles/image/hinh%20phim/'.$k['mv_bigimg'].'"  rel="lightbox"><img src="'.PATH_HTTP.'image/chitiet.gif" border="0"></a></div>
									<div class="movie_title" >'.$k['mv_name_en'].'</div>
									<div class="movie_title" >'.$k['mv_name'].'</div>
									<div class="year"> Năm sản xuất :'.$k['mv_year'].'</div> 
									<div class="subtitles">Phụ đề : '.$k['mv_subtitles'].'</div> 
									<div class="resolution">'.$k['mv_resolution'].'</div> 															 
								</div>';
								$show.='</td>';
							if($i%$columns==0)$show.='</tr>';
							if($i%$columns==0 && $i<$ttk)$show .= '<tr><td colspan="'.$columns.'" height="1" bgcolor="#EFEFEF" ></td></tr><tr><td colspan="3" height="8" ></td></tr>';
				}
				$i++;
				$numnews++;			
			}			
			$show .= '<tr><td colspan="'.$columns.'"><div align="center" >'.$pub->paging("paging",$ttk,$curpage,$maxpage,$maxrow).'</div></td></tr></form></table>';
			}else{
				$show.="<br><br><center> Không tìm thấy sản phẩm</center><br>";
			}
			
		$sql->free_result($result);
		return $show;		
	}
	/*
	
	function GetMovieList($cat_id,$sub_id,$dk,$width,$height,$maxrows,$columns){
		global $sql,$pub;
				
		$show = '';
		$p = isset($_REQUEST['curpg']) ? $_REQUEST['curpg'] : 1;
		$slt = "*";
			if($dk=="1"){
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE  mv_active="1"   ORDER BY mv_dateadd DESC  ');												
			}
			if($dk=="3"){
				if(($cat_id!="")&&($sub_id!="")){
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="'.$cat_id.'" AND sub_id="'.$sub_id.'" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
				}if(($cat_id!="")&&($sub_id=="")){
					$result = $sql->query('SELECT '.$slt.' FROM movie  WHERE   parent_id="'.$cat_id.'" AND mv_active="1"   ORDER BY mv_dateadd DESC  ');												
				}				
			}						
		if($sql->num_rows($result)>0){								
			$ttk 	 = $sql->num_rows($result);				
			$maxrow  = $maxrows; $maxpage = 4;
			$curpage = $p; $numnews = 0;
			$i=1;
			if($ttk >0) 			
			$show .= '<table width="100%" border="0"><form action="" method="post" name="frm_page" id="frm_page">
			<input type="hidden" name="curpg" value="'.$p.'">';		
			$i=1;
			while ($k=$sql->fetch_array($result)) {				
				if(($numnews >= ($curpage-1)*$maxrow) && ($numnews < ($curpage*$maxrow)) ){
					$show .='  <td align="center" style="padding-top: 10px;">
							

							 <table align=center cellpadding=0 cellspacing=0 width=33% height=210 >

                <tr>

					<td align=center valign="middle" height="150">

						<div id="dhtmltooltip">

							<a href="" title="Scandal Makers - Ông Ngoại Tuổi 30" onmouseout="hideddrivetip()" onmouseover="ddrivetip(&quot;<img src=\''.PATH_HTTP.'userfiles/image/hinh%20phim/'.$k['mv_bigimg'].'\' >&quot;)">

							<span><img src="'.PATH_HTTP.'upload_img/movie/'.$k['mv_smallimg'].'" border="0" class="cover_1" /></span></a>

						</div>

					  </td></tr>

				<tr>
					<td class="movie_title" >'.$k['mv_name'].'</td>
				</tr>
				
            </table>';
								
								$show.='</td>';
							if($i%$columns==0)$show.='</tr>';
							if($i%$columns==0 && $i<$ttk)$show .= '<tr><td colspan="'.$columns.'" height="1" bgcolor="#EFEFEF" ></td></tr><tr><td colspan="3" height="8" ></td></tr>';
				}
				$i++;
				$numnews++;			
			}			
			$show .= '<tr><td colspan="'.$columns.'"><div align="center" >'.$pub->paging("paging",$ttk,$curpage,$maxpage,$maxrow).'</div></td></tr></form></table>';
			}else{
				$show.="<br><br><center> Không tìm thấy sản phẩm</center><br>";
			}
			
		$sql->free_result($result);
		return $show;		
	}
	*/
	
	
	function GetProductDetail($product_id)
	{
		global $sql,$pub,$news;
		$bshow = '';
		$result = $sql->query("SELECT * FROM product WHERE pro_id='".$product_id."'");
		if($sql->num_rows($result)>0){
			while($k=$sql->fetch_array($result)){
				$title		= $pub->CutStr($k['pro_title']); 
				$link_order	= PATH_HTTP.'Cart/Cart/'.$k['pro_id'].'/';
				if($k['pro_price']==""){$price ='<a href="'.PATH_HTTP.'ContactPrice/'.$k['pro_id'].'/" style="color:green; text-decoration:none;">Liên hệ báo giá</a>'; }
				else{$price = $pub->StrMoney($k['pro_price']+0);}
				if($k['pro_bigimg']!=""){
									$img = '<a  href="'.PATH_HTTP.'upload_img/product/'.$k['pro_bigimg'].'"  onclick="return hs.expand(this)" class=" "><img src="'.PATH_HTTP.'upload_img/product/'.$k['pro_bigimg'].'" width="200" height="200" title="'.WEBSITE.'" ></a>';
								}else{
									$img = '<a  href="'.PATH_HTTP.'upload_img/product/'.$k['pro_smallimg'].'"  onclick="return hs.expand(this)"  class=" "><img src="'.PATH_HTTP.'upload_img/product/'.$k['pro_smallimg'].'" width="200" height="200" title="'.WEBSITE.'" ></a>';		
								}
								
				  
				$bshow.='
				<div class="prod_box_big">
					<div class="top_prod_box_big"></div>
					<div class="center_prod_box_big">            
						 
						 <div class="product_img_big">'.$img.' </div>
							 <div class="details_big_box">
								 <div class="product_title_big">'.$k['pro_title'].'</div>
								 
								 
								 <div class="prod_price_big"> Bảo hành: <span class="price">'.$k['pro_warranty'].'</span></div>
								 <div class="prod_price_big"> Giá bán: <span class="price">'.$price.'</span></div>
								 <a href="'.$link_order.'" class="addtocart">Chọn mua</a>
								 
							 </div>
							 <div class="center_prod_box_big">
							 <div class="specifications">
									'.$k['pro_detail'].'
								 </div>
							        </div>                  
					</div>
					<div class="bottom_prod_box_big"></div>                                
				</div>';
				$bshow.='';
				
			}
		}else{
			$bshow .='<br><br><center><font face="Tahoma" size="2"> Not result</font></center>';
		}		
		$sql->free_result($result);
		return $bshow;		
	}
	
	
	function GetProductDetail1($product_id)
	{
		global $sql,$pub,$news;
		$bshow = '';
		$result = $sql->query("SELECT * FROM product WHERE pro_id='".$product_id."'");
		if($sql->num_rows($result)>0){
			while($k=$sql->fetch_array($result)){
				$title		= $pub->CutStr($k['pro_title']); 
				$link_order	= PATH_HTTP.'Cart/Cart/'.$k['pro_id'].'/';
				if($k['pro_price']==""){$price ='<a href="'.PATH_HTTP.'ContactPrice/'.$k['pro_id'].'/" style="color:green; text-decoration:none;">Liên hệ báo giá</a>'; }
				else{$price = $pub->StrMoney($k['pro_price']+0);}
				if($k['pro_bigimg']!=""){
									$img = '<a  href="'.PATH_HTTP.'upload_img/product/'.$k['pro_bigimg'].'"  onclick="return hs.expand(this)"><img src="'.PATH_HTTP.'upload_img/product/'.$k['pro_bigimg'].'" width="200" height="200" title="'.WEBSITE.'" ></a>';
								}else{
									$img = '<a  href="'.PATH_HTTP.'upload_img/product/'.$k['pro_smallimg'].'"  onclick="return hs.expand(this)"><img src="'.PATH_HTTP.'upload_img/product/'.$k['pro_smallimg'].'" width="200" height="200" title="'.WEBSITE.'" ></a>';		
								}
								
				  
				$bshow.='
				<div class="prod_box_big">
					<div class="top_prod_box_big"></div>
					<div class="center_prod_box_big">            
						 
						 <div class="product_img_big">'.$img.' </div>
							 <div class="details_big_box">
								 <div class="product_title_big">'.$k['pro_title'].'</div>
								 
								 
								 <div class="prod_price_big"> Bảo hành: <span class="price"></span></div>
								 <div class="prod_price_big">  <span class="price">'.$k['pro_content'].'</span></div>
								 
								 
							 </div>
							 <div class="center_prod_box_big">
							 
							        </div>                  
					</div>
					<div class="bottom_prod_box_big"></div>                                
				</div>';
				$bshow.='';
				
			}
		}else{
			$bshow .='<br><br><center><font face="Tahoma" size="2"> Not result</font></center>';
		}		
		$sql->free_result($result);
		return $bshow;		
	}		
		
	function GetProductList($cat_id,$sub_id,$dk,$width,$height,$maxrows,$columns){
		global $sql,$pub;
		$txtsearch	= isset($_REQUEST['txtSearch'])? $_REQUEST['txtSearch']:null ;
		
		$show = '';
		$p = isset($_REQUEST['curpg']) ? $_REQUEST['curpg'] : 1;
		$slt = "*";
			if($dk=="0"){
				$result = $sql->query('SELECT '.$slt.' FROM product  WHERE pro_active="1" AND pro_type="2" OR pro_type="3" ORDER BY pro_dateadd DESC ');									
			}if($dk=="1"){
				$result = $sql->query('SELECT '.$slt.' FROM product  WHERE pro_type="2" AND pro_homepage="1" AND pro_active="1"    ORDER BY pro_dateadd DESC  LIMIT 0,'.$maxrows.' ');									
			}if($dk=="2"){
				$result = $sql->query('SELECT '.$slt.' FROM product  WHERE  pro_type="5" AND pro_homepage="1" AND pro_active="1"    ORDER BY pro_dateadd  DESC  LIMIT 0,'.$maxrows.' ');									
			}			
			if($dk=="3"){
				if(($cat_id!="")&&($sub_id!="")){
					$result = $sql->query('SELECT '.$slt.' FROM product  WHERE   parent_id="'.$cat_id.'" AND sub_id="'.$sub_id.'" AND pro_active="1"   ORDER BY pro_dateadd DESC  ');												
				}
				if(($cat_id!="")&&($sub_id=="")){
					$result = $sql->query('SELECT '.$slt.' FROM product  WHERE   parent_id="'.$cat_id.'" AND pro_active="1"   ORDER BY pro_dateadd DESC  ');												
				}				
			}
			if($dk=="4"){
				$cat_id=$_REQUEST['parent_id'];
				$txtsearch	= isset($_REQUEST['txtSearch'])? $_REQUEST['txtSearch']:null ;				
					if($txtsearch!="" && $cat_id!=""){
						$result = $sql->query('SELECT '.$slt.' FROM product  WHERE  parent_id='.$cat_id.' and pro_title LIKE "%'.$txtsearch.'%" AND pro_active="1"   ORDER BY pro_dateadd DESC  ');												
					}if($txtsearch!="" && $cat_id==""){					
						$result = $sql->query('SELECT '.$slt.' FROM product  WHERE  pro_title LIKE "%'.$txtsearch.'%" AND pro_active="1"   ORDER BY pro_dateadd DESC  ');																	
					}if($txtsearch=="" && $cat_id!=""){
						$result = $sql->query('SELECT '.$slt.' FROM product  WHERE  parent_id='.$cat_id.' and  pro_active="1"   ORDER BY pro_dateadd DESC  ');												
					}if($txtsearch=="" && $cat_id==""){					
						$result = $sql->query('SELECT '.$slt.' FROM product  WHERE  pro_active="1"   ORDER BY pro_dateadd DESC  ');																	
					}
										
			}if($dk=="5"){
				$result = $sql->query('SELECT '.$slt.' FROM product  WHERE  pro_id<>"'.$cat_id.'" AND sub_id="'.$sub_id.'" AND pro_homepage="1" AND pro_active="1"    ORDER BY pro_dateadd LIMIT 0,'.$maxrows.' ');									
			}
			if($dk=="6"){
				$result = $sql->query('SELECT '.$slt.' FROM product  WHERE pro_active="1" AND pro_type="4" ORDER BY pro_dateadd DESC ');									
			}
						
		if($sql->num_rows($result)>0){								
			$ttk 	 = $sql->num_rows($result);				
			$maxrow  = $maxrows; $maxpage = 4;
			$curpage = $p; $numnews = 0;
			$i=1;
			if($ttk >0) 			
			$show .= '<table width="100" border="0" >
			<form action="" method="post" name="frm_page" id="frm_page"><input type="hidden" name="curpg" value="'.$p.'">';		
			$i=1;
			$mshow ='';
			while ($k=$sql->fetch_array($result)) {				
				if(($numnews >= ($curpage-1)*$maxrow) && ($numnews < ($curpage*$maxrow)) ){
					$name 		= $pub->CutStr($k['pro_title']);
					$link		= PATH_HTTP.'Product/Detail/'.$k['sub_id'].'/'.$k['pro_id'].'/'.$name.'.html';
					$link_order	= PATH_HTTP.'Cart/Cart/'.$k['pro_id'].'/';
							
							if($k['pro_type']=="2"){
								$imgnew	= '<img src="'.PATH_HTTP.'image/new.gif" border="0">';
							}else{
								$imgnew = '';
							}
							if($k['pro_bigimg']!=""){ $img	= $k['pro_bigimg'];								
							}else{ $img	= $k['pro_smallimg'];}
							if($k['pro_price']==""){$price ='<a href="'.PATH_HTTP.'ContactPrice/'.$k['pro_id'].'/" style="color:green; text-decoration:none;">Liên hệ báo giá</a>'; }
							else{$price = $pub->StrMoney($k['pro_price']+0);}
							
							$show .='<td><div class="prod_box">
								<div class="top_prod_box"></div>
								<div class="center_prod_box">            
									 <div class="product_img">
									<a  href="'.$link.'"   data-tooltip="'.$k['pro_id'].'">
									<img src="'.PATH_HTTP.'upload_img/product/'.$k['pro_smallimg'].'"  alt="'.$k['pro_title'].'" width="'.$width.'" height="'.$height.'" border="0" class="left" title=""/></a>
										</div>
								</div>';
								
							if(($dk!="1")&&($dk!="2")){
								$mshow .='<div id="'.$k['pro_id'].'" class="atip" style="width:420px; padding:3px 3px 3px 3px;">
									<p style="background-color:#FFFFFF; color:red; font-weight:bold; height:25px;font-size:16px; "><b>'.$k['pro_title'].'</b></p>
									'.$k['pro_content'].'</div>';							
							}
							
							$show .='<div class="bottom_prod_box"></div>             
								<div class="prod_details_tab">
								<a href="'.$link.'" class="prod_details">chi tiết</a> 
								<a href="'.$link_order.'" class="left_bt">chọn mua</a>
								</div>';
								     $show.='<div class="product_title" style="text-align:center;color:#2F66A7;padding:10px 0 0 0;" > <a href="'.$link.'">'.$k['pro_title'].'</a>'.$imgnew.'</div>
									 <div class="product" >&nbsp;<div>
									 <div class="prod_price" style="padding:0 0 10px 0;" > <span class="price">Giá bán: '.$price.'</span></div>';                    
							$show.='</div></td>';
							if($i%$columns==0)$show.='</tr>';
							if($i%$columns==0 && $i<$ttk)$show .= '<tr><td colspan="'.$columns.'" height="1" bgcolor="#EFEFEF" ></td></tr><tr><td colspan="3" height="8" ></td></tr>';
													
				}
					
				$i++;
				$numnews++;			
			}			
			if(($dk!="1")&&($dk!="2")){
				$show.='<div id="mystickytooltip" class="stickytooltip">'.$mshow.'</div>';
			}
			$show .= '<tr><td colspan="3"><div  align="center" >'.$pub->paging_java2("paging",$ttk,$curpage,$maxpage,$maxrow).'</div></td></tr>
					</form></table>';
			}else{
				$show.="<br><br><center> Không tìm thấy sản phẩm</center><br>";
			}
			
		$sql->free_result($result);
		return $show;		
	}
		function Showimghomepage(){
		global $sql,$pub;
		$show = '';
		$slt = "*";						
		$result = $sql->query('SELECT '.$slt.' FROM product  WHERE pro_type="2"  OR pro_type="5" AND pro_homepage="1" AND pro_active="1"    ORDER BY pro_dateadd DESC  LIMIT 0,12 ');																		
		if($sql->num_rows($result)>0){
		$show.='<div id="mystickytooltip" class="stickytooltip">';								
			while ($k=$sql->fetch_array($result)) {				
						$show .='<div id="'.$k['pro_id'].'" class="atip" style="width:420px; padding:3px 3px 3px 3px;">
							<p style="background-color:#FFFFFF; color:red; font-weight:bold; height:25px;font-size:16px; "><b>'.$k['pro_title'].'</b></p>
							'.$k['pro_content'].'</div>';							
					
			}
		}			

			$show.='</div>';
			
		$sql->free_result($result);
		return $show;		
	}
	
	function GetNewsList($parent_id,$sub_id){		
	 global $sql,$pub,$news;
			$arr_news = array();	
			$show = '';
			$curpg = isset($_REQUEST['curpg']) ? $_REQUEST['curpg'] : 1;
			$slt = "*";
			
				$result=$sql->query('SELECT '.$slt.' FROM news  WHERE   sub_id="'.$sub_id.'" AND news_active="1"   ORDER BY news_dateadd DESC  ');												
			
			$rows_news = $sql->num_rows($result);
			
			$show = '<DIV>';
			if($rows_news>0){
					$show .= '<br /><form name="frm_page" method="post" action="'.$_SERVER['REQUEST_URI'].'">
					<input type="hidden" name="curpg" value="'.$curpg.'">';
					
					$i_view 	= 0;
					$maxrow 	= 5 ;
					$maxpage 	= 4 ;
					$somautin 	= 0;
					$i 			= $rows_news;
					while($k=$sql->fetch_array($result)){
						if (($somautin >= ($curpg-1) * $maxrow) && ($somautin < $curpg * $maxrow)){
						$name	= $pub->CutStr($k['news_title']);
						$link = ''.PATH_HTTP.'Detail/'.$k['sub_id'].'/'.$k['news_id'].'/'.$name.'.html';
						$show .='<DIV>
								<TABLE width="95%" cellSpacing=2 cellPadding=2 border=0>
								  <TBODY>';
								  if($k["news_title"]!=""){
								  $show.='<TR>
									<TD align="left"  colspan="2" height="30"><a href="'.$link.'" class="linknews"><b> &raquo;&nbsp;'.$k["news_title"].'</b></a></TD>
								  </TR>';
								  }													
								  if($k['news_smallimg']!=""){
									  $show .= '<TR >
											<td  width="100" height="100"><img src="'.PATH_HTTP.'upload_img/small_img/'.$k['news_smallimg'].'" vspace="5" hspace="5" ></td>
											<TD  >'.stripslashes($k["news_content"]).'</TD>
										  </TR>';	
									}else{
									  $show .= '<TR >
											<TD  colspan="2">'.stripslashes($k["news_content"]).'</TD>
										  </TR>';										
									}			
									$show .='<TR><TD colspan="2" align="right"><a href="'.$link.'" ><img src="'.PATH_HTTP.'image/xem_het.gif" border="0"></a>&nbsp;&nbsp;</TD></TR>';							

								  $show .='<TR><TD background="'.PATH_HTTP.'image/line_width.gif" height="2" colspan="2" ></TD></TR>			  
								  </TBODY>
								 </TABLE></DIV>';

						}	
						$i--;
						$somautin ++ ;		
					}
					$show.='<DIV align="center">'.$pub->paging_java2("paging",$rows_news,$curpg,$maxpage,$maxrow).'</DIV>';					
			}else{
					$show .= '<DIV align="center">&nbsp;Not Result</DIV>';
			}				
			$show .= '</form></DIV>';
		$sql->free_result($result);			
		return $show;			
	}
	
	
	
	///////////////////////////////////////////
	function GetNewsIntro($cat_id,$dk){		
	 global $sql,$pub;
			$arr_news = array();	
			$show = '';
			$slt = "*";			
			if($dk=="1"){
				$result = $sql->query('SELECT '.$slt.' FROM news  WHERE parent_id="'.$cat_id.'"   AND news_homepage="1"  LIMIT 1 ');																	
			}
			else{
				$result = $sql->query('SELECT '.$slt.' FROM news  WHERE  parent_id="'.$cat_id.'"   ORDER BY news_dateadd DESC  ');															
			}
			$rows_news = $sql->num_rows($result);
			$show = '<DIV>';
			if($rows_news>0){
					while($k=$sql->fetch_array($result)){
						
						$show .='<DIV>
								<TABLE width="98%">
								  <TBODY>';
								  if($k["news_title"]!=""){
									  $show.='<TR>
										<TD align="left"><b>&nbsp;&raquo;&nbsp;'.$k["news_title"].'</b></TD>
									  </TR>';
								  }								
									 if($k['file_flv']!=""){
									  $show.= $news->Show_FLV($k['news_id'],$k['type_flv'],"".$k['file_flv']."","381","290");
									 }										   			
								  	  $show .= '<TR>
										<TD>'.stripslashes($k["news_content"]).'</TD>
									  </TR>';								  
								  $show.='</TBODY>
								 </TABLE></DIV>';
	
					}
			}else{
					$show .= '<br><br><br><DIV align="center">&nbsp;'.NOTDATA.'!</DIV>';
			}				
			$show .= '</DIV>';

		$sql->free_result($result);			
		return $show;			
	}	
	function GetListNewsHot(){		
		global $pub;
		$slt	= 'news_id,parent_id, sub_id,news_title';
		$show='';			
		$result = mysql_query('SELECT '.$slt.' FROM news WHERE news_hot="1" AND news_active="1"  ORDER BY news_dateadd  DESC  LIMIT 0,10');						
					while($k=mysql_fetch_array($result)){				
						$name = $pub->CutStr($k['news_title']);
						$link = ''.PATH_HTTP.'Detail/'.$k['sub_id'].'/'.$k['news_id'].'/'.$name.'.html';
						$show .='<li><a href="'.$link.'" title="'.$k['news_title'].'" > '.$k['news_title'].'</a></li>';
					}			
		return $show;
	}
	function GetNewsDetail($news_id)
	{
		global $sql,$news;
		$show = '';

		$result  = $sql->query("SELECT * FROM news WHERE news_id='".$news_id."'");
		while($k=$sql->fetch_array($result)){
						$show .='<TABLE width="100%" border="0" >
								  <TBODY>';
								  if($k['news_title']!=""){
									  $show .='<TR>
										<TD  height="30" colspan="2"><font size="3" face="Tahoma" color="#FF0000"><b>&nbsp;&gt;&gt;&nbsp;'.$k["news_title"].'</b></font></TD>
									  </TR>';
									}								 											
								  	if($k['file_flv']!=""){
										 $show.='<tr><td colspan="2" align="center">'; 
											$show.= $news->Show_FLV($k['news_id'],$k['type_flv'],"".$k['file_flv']."","381","290");
											$show.='</td></tr>';
										 }											
								 $show.='<tr><td colspan="2">'.stripslashes($k["news_detail"]).'</td></tr>';
 								if($k['file']!=""){
 									 $show .= '<TR>
										<TD ALIGN="center" ><a href="'.PATH_HTTP.'upload_img/'.$k['file'].'" target="_blank"><img src="'.PATH_HTTP.'image/download.gif" border="0"></a></TD>
									  </TR>';		
								 }									 $show.='<tr><td colspan="2" height="40" align="center">
								 <a href="#"  class="linkmleft_1"><img src="'.PATH_HTTP.'image/top.png" border="0"> Top</a>&nbsp; 
									<a href="#" onclick="window.open(\''.PATH_HTTP.'prints.php?news_id='.$news_id.'\', \'NewWinOpen\', \'top = 0,left = 200 ,scrollbars=yes, resizable=no,height=700, width=680\')"  class="linkmleft_1"><img src="'.PATH_HTTP.'image/print.gif" border="0"> In </a>&nbsp;&nbsp;<A href="#" onclick="window.history.go(-1);" class="linkmleft_1"><img src="'.PATH_HTTP.'image/back.gif" border="0"> Trở lại</a>&nbsp;
									&nbsp;<font class="linkmleft_1">Chia sẻ : </font><a href="javascript:;" onclick="share_facebook();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/facebook.gif" border="0" title="Chia sẻ trên Facebook"  align="absmiddle"></a>
								 <a href="javascript:;" onclick="share_twitter();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/twitter.gif" border="0" title="Chia sẻ trên Twitter"  align="absmiddle"></a>
								 <a href="javascript:;" onclick="share_google();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/google.gif" border="0" title="Chia sẻ trên Google"  align="absmiddle"></a>
								 <a href="javascript:;" onclick="share_buzz();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/buzz.gif" border="0" title="Chia sẻ trên Yahoo Buzz"  align="absmiddle"></a>
								 <a href="javascript:;" onclick="share_dzone();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/dzone.png" border="0" title="Chia sẻ trên Dzone"  align="absmiddle"></a>
								 <a href="javascript:;" onclick="share_furl();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/furl.png" border="0" title="Chia sẻ trên Furl"  align="absmiddle"></a>
				 				 <a href="javascript:;" onclick="share_reddit();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/reddit.png" border="0" title="Chia sẻ trên Reddit"  align="absmiddle"></a>
				 				 <a href="javascript:;" onclick="share_technorati();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/technorati.png" border="0" title="Chia sẻ trên Technorati"  align="absmiddle"></a></td></tr>
								 </tbody></table>';															
						  $show .=	'<table width="100%"  border="0" cellspacing="0" cellpadding="0">
									  <tr>
										<td height="30"  class="linknews" bgcolor="#EFEFEF"  ><b>&nbsp;&raquo;&nbsp;Tin tiếp theo</b></td>
									  </tr>
									  <tr><td><br><div><ul >'.$news->GetListNewsHot().'
									  </ul></div>
									  </td></tr>
							  		</table>';				
		}
		$sql->free_result();
		return $show;		
	}
	
	function ShowNewsHot($sub_id,$limit){		
		global $sql,$pub;
		$slt	= 'news_id,parent_id,sub_id,news_title,news_smallimg,news_content,news_hot';
		$show	= '';					
			$result = $sql->query('SELECT '.$slt.' FROM news WHERE sub_id="'.$sub_id.'" AND news_homepage="1" AND news_hot="1" AND news_active="1"  ORDER BY news_dateadd DESC  LIMIT 0,'.$limit.'');						
				$i=0;
				$show .='<ul>';
					while($k=$sql->fetch_array($result)){										
						$name = $pub->CutStr($k['news_title']);
						$link = ''.PATH_HTTP.'TIN-TUC/'.$k['sub_id'].'/'.$k['news_id'].'/'.$name.'.html';
							if($i%2==0){ 
								$class_2	= '';
							}
							else{ 
								$class_2	= 'class="clear_g"';								
							}
							$parent_id	= $k['parent_id'];
							$show .='<li '.$class_2.'>
					        <div class="items">
						        <p><a href="'.$link.'">'.$pub->TrimStr($k['news_title'],50).'</a></p>
						        <a href="'.$link.'"><img class="img" src="'.PATH_HTTP.'upload_img/small_img/'.$k['news_smallimg'].'" title="'.$k['news_title'].'" height="70" align="center"></a>
						        <span>'.$pub->TrimStr($k['news_content'],90).'</span>
				            </div>
					        </li>';		
							 $i++;					
					}			
					$show .='</ul';
							$show.='<br><br class="clear">
								<div class="view_more"><a href="'.PATH_HTTP.'Tin-tuc/'.$parent_id.'/'.$sub_id.'/"><b>Xem tất cả</b></a></div>';					
		$sql->free_result($result);
		return $show;
		
	}	
	
	function GetSubNewsDetail($parent_id,$sub_id)
	{
		global $sql;
		$bshow = '';
		$sql->query("SELECT n.parent_id, n.news_id, n.news_title, n.news_content, n.news_detail FROM news n, subcatenews s WHERE n.parent_id=s.subnews_id AND s.subnews_type='1' AND s.subnews_id='".$sub_id."' LIMIT 1");
		if($sql->num_rows()>0){
			while($rw=$sql->fetch_array()){
				$bshow .= '<table width="450" border="0" cellspacing="0" cellpadding="0" align="center">
									   <tr><td  height="10" colspan="2"></td></tr>	
									   <tr><td bgcolor="#CCCCCC"  height="1" colspan="2"></td></tr>	
									   <tr><td><b>&nbsp;&raquo;&nbsp;'.$rw["news_title"].'</b></td></tr>
									   <tr><td bgcolor="#CCCCCC"  height="1" colspan="2"></td></tr>										
									   <tr><td  height="5" colspan="2"></td></tr>									
									   <tr><td colspan="3">'.stripslashes($rw["news_content"]).'</td></tr>
									   <tr><td colspan="3">'.stripslashes($rw["news_detail"]).'</td></tr>
						  </table>';
			}
		}else{
			$bshow .='<br><br><center><font face="Tahoma" size="2"> Not result</font></center>';
		}		
		$sql->free_result();
		return $bshow;		
	}	
	
	function GetCatImg(){
		global $sql,$pub;
		$show = '';
		$p = isset($_REQUEST['curpg']) ? $_REQUEST['curpg'] : 1;
		$slt    = "*";	
		$sql->query("SELECT ".$slt." FROM images WHERE img_active='1' ORDER BY img_dateadd DESC  LIMIT 0,4 ");						
		
		if($sql->num_rows()>0){								
			$ttrw 	 = $sql->num_rows();				
			$maxrow  = 4; $maxpage =2;
			$curpage = $p; $numnews = 0;
			$i=1;
			
			$max_product = $maxrow * $p;	
			$min_product_current = ($max_product - $maxrow)+1;
			if($max_product > $ttrw) $max_product_current = $ttrw;
			else $max_product_current = $max_product;
			if($ttrw >0) 			
			$show .= '<table border="0" width="100%" cellspacing="0" cellpadcding="0"><form action="" method="post" name="frm_page" id="frm_page"><input type="hidden" name="curpg" value="'.$p.'">';		
			$i=1;
			while ($rw=$sql->fetch_array()) {				
				if(($numnews >= ($curpage-1)*$maxrow) && ($numnews < ($curpage*$maxrow)) ){
				
					if($i==1) $show .= '<tr>';
					$link	= 'upload_img/'.$rw['news_smallimg'].'';
							$show .= '<td width="250" align="center" valign="top" style="padding-top:3px; padding-bottom:3px;">													
							<div><a href="?cc='.encode_all('m0=images&m1='.$rw['img_id'].'').'" border="0"><img src="upload_img/'.$rw['img_small'].'" border="0" width="143" height="200"></a></div>							
							</td> ';
							
					if($i%2==0) $show .= '</tr>';
					if($i%2==0 && $i<$ttrw) $show .= '<tr><td colspan="2" height="1" bgcolor="#CCCCCC" ></td></tr>';
				}
				$i++;
				$numnews++;			
			}			
			$show .= '</form>
					</table>';
			}else{
				$show.="<br><br><center> </center>";
			}
			
		$sql->free_result();
		return $show;		
	}
		function ShowListImg($parent_id,$dk){
		global $sql,$pub;
		$show = '';
		$slt    = "*";	

		$sql->query("SELECT ".$slt." FROM images WHERE  img_active='1' ORDER BY i_dateadd DESC  ");						
		$i = 1;
		while ($k=$sql->fetch_array()) {				
			if($dk=="1"){
				$show .='<div class="contentdiv" style="width: 100%; height: 100%; display: none; z-index: '.$i.'; opacity: 1; visibility: visible;"><img src="'.PATH_HTTP.'upload_img/big_img/'.$k['img_big'].'" title="'.$k['img_title'].'"></div>';										
			}
			if($dk=="2"){
				$show .='<div style="float: none; position: absolute; left: 0px;" class="panel">
                        <a rel="'.$i.'" class="toc" href="#"><img src="'.PATH_HTTP.'upload_img/small_img/'.$k['img_small'].'" width="100px" height="90" vspace="3" hspace="3" border="0" title="'.$k['img_title'].'"></a>
                      </div>';										
			}			
		}						
			
		$sql->free_result();
		return $show;		
	}	
	
			
		function GetNewsHomepage_1($parent_id,$sub_id,$dk){
			global $sql,$news;
				$show = '';
				$slt    = "news_id, news_title, parent_id,sub_id,news_content";	
				if(($sub_id!="")&&($dk=="1")){
					$sql->query("SELECT ".$slt." FROM news WHERE parent_id='".$parent_id."' AND sub_id='".$sub_id."' AND news_homepage='1' AND news_type='0' AND news_active='1' ORDER BY news_dateadd DESC  LIMIT 0,1");						
				}
				if(($sub_id!="")&&($dk=="0")){
					$sql->query("SELECT ".$slt." FROM news WHERE parent_id='".$parent_id."' AND sub_id='".$sub_id."' AND news_active='1' AND news_type='0' ORDER BY news_dateadd DESC  LIMIT 0,1");										
				}
				if(($parent_id!="")&&($dk=="1")&&($sub_id=="")){
					$sql->query("SELECT ".$slt." FROM news WHERE parent_id='".$parent_id."'  AND news_homepage='1' AND news_active='1' AND news_type='0' ORDER BY news_dateadd DESC  LIMIT 0,1");										
				}	
				
					while ($k=$sql->fetch_array()) {	
                    $show.=''.$k['news_content'].'';
					}
			$sql->free_result();
			return $show;			
		}
		function GetNewsHomepage_2($parent_id,$sub_id,$limit){
			global $sql,$pub;
				$show = '';
				$slt    = "news_id, news_title, parent_id,sub_id,news_smallimg,news_content";	
				if($sub_id!=""){
					$sql->query("SELECT ".$slt." FROM news WHERE parent_id='".$parent_id."' AND sub_id='".$sub_id."' AND news_type='0' AND  news_active='1' ORDER BY news_dateadd DESC  LIMIT 0,".$limit."");						
				}else{
					$sql->query("SELECT ".$slt." FROM news WHERE parent_id='".$parent_id."' AND news_homepage='1'  AND news_type='0' AND news_active='1' ORDER BY news_dateadd DESC  LIMIT 0,".$limit."");									
				}
					while ($k=$sql->fetch_array()) {	
						$name = $pub->CutStr($k['title']);
						$link = ''.PATH_HTTP.'TIN-TUC/'.$k['parent_id'].'/'.$k['news_id'].'/'.$name.'.html';
                     $show.='<tr>
                        <td height="22" colspan="2"><a href="'.$link.'" class="linkmleft_1"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;'.$k['news_title'].'</strong></a></td>
                      </tr>';
					  if($k['news_smallimg']!=""){
						  $show.='<tr>
							<td width="16%"><div align="center"><a href="'.$link.'" class="linkmleft_1"><img src="'.PATH_HTTP.'upload_img/'.$k['news_smallimg'].'" vspace="2" hspace="3"></a></div></td>
							<td width="84%">'.$k['news_content'].'</td> 
						  </tr>';
					 }else{
						  $show.='<tr>
							<td colspan="2">'.$k['news_content'].'</td>
						  </tr>';					 				
					}
				 }
			$sql->free_result();
			return $show;			
		}						
	
	function GetVideoDetail($news_id)
	{
		global $sql,$news;
		$show = '';
		$result  = $sql->query("SELECT * FROM news WHERE news_id='".$news_id."'");
		while($k=$sql->fetch_array($result)){
						$show .='<TABLE width="100%" border="0" >
								  <TBODY>';
								  if($k['news_title']!=""){
									  $show .='<TR>
										<TD  height="30" colspan="2"><font size="3" face="Tahoma" color="#FF0000"><b>'.$k["news_title"].'</b></font></TD>
									  </TR>';
									}								 											
								  	if($k['file_flv']!=""){
										 $show.='<tr><td colspan="2" align="center">'; 
											$show.= $news->Show_FLV($k['news_id'],$k['type_flv'],"".$k['file_flv']."","381","290");
											$show.='</td></tr>';
										 }											
								 $show.='<tr><td colspan="2" height="40" align="center">
								 <a href="#"  class="linkmleft_1"><img src="'.PATH_HTTP.'image/top.png" border="0"> Top</a>&nbsp; 
									&nbsp;&nbsp;<A href="#" onclick="window.history.go(-1);" class="linkmleft_1"><img src="'.PATH_HTTP.'image/back.gif" border="0"> Trở lại</a>&nbsp;
									&nbsp;<font class="linkmleft_1">Chia sẻ : </font><a href="javascript:;" onclick="share_facebook();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/facebook.gif" border="0" title="Chia sẻ trên Facebook"  align="absmiddle"></a>
								 <a href="javascript:;" onclick="share_twitter();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/twitter.gif" border="0" title="Chia sẻ trên Twitter"  align="absmiddle"></a>
								 <a href="javascript:;" onclick="share_google();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/google.gif" border="0" title="Chia sẻ trên Google"  align="absmiddle"></a>
								 <a href="javascript:;" onclick="share_buzz();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/buzz.gif" border="0" title="Chia sẻ trên Yahoo Buzz"  align="absmiddle"></a>
								 <a href="javascript:;" onclick="share_dzone();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/dzone.png" border="0" title="Chia sẻ trên Dzone"  align="absmiddle"></a>
								 <a href="javascript:;" onclick="share_furl();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/furl.png" border="0" title="Chia sẻ trên Furl"  align="absmiddle"></a>
				 				 <a href="javascript:;" onclick="share_reddit();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/reddit.png" border="0" title="Chia sẻ trên Reddit"  align="absmiddle"></a>
				 				 <a href="javascript:;" onclick="share_technorati();" style="margin-right: 2px"><img src="'.PATH_HTTP.'image/technorati.png" border="0" title="Chia sẻ trên Technorati"  align="absmiddle"></a></td></tr></tbody></table>';															
						  $show .=	'<table width="100%"  border="0" cellspacing="0" cellpadding="0">
									  <tr>
										<td height="30"  class="linknews" bgcolor="#EFEFEF"  ><b>&nbsp;&raquo;&nbsp;Video tiếp theo</b></td>
									  </tr>
									  <tr><td><div><ul >'.$news->GetListVideoHot($k['parent_id'],$news_id,">","DESC ").'
									  '.$news->GetListVideoHot($k['parent_id'],$news_id,"<","DESC ").'</ul></div>
									  </td></tr>
							  		</table>';				
		}
		$sql->free_result();
		return $show;		
	}
	function GetListVideoHot($cat_id,$news_id,$dk,$sort){		
		global $pub;
		$slt	= 'news_id,parent_id, sub_id,news_title';
		$show='';			
		$result = mysql_query('SELECT '.$slt.' FROM news WHERE parent_id="'.$cat_id.'" AND news_id '.$dk.' "'.$news_id.'" AND news_title<>"" AND file_flv<>"" AND news_type="2" AND news_active="1"  ORDER BY news_dateadd '.$sort.' LIMIT 0,30');						
					while($k=mysql_fetch_array($result)){				
						$name = $pub->CutStr($k['news_title']);
						$link = ''.PATH_HTTP.'VideoDetail/'.$k['parent_id'].'/'.$k['news_id'].'/'.$name.'.html';
						$show .='<li><a href="'.$link.'" title="'.$k['news_title'].'" class="linknews"> '.$k['news_title'].'</a></li>';
					}			
		return $show;
	}	
	function ShowVideoHot(){		
		global $pub;
		$slt	= 'news_id,parent_id, sub_id,news_title';
		$show='';			
		$result = mysql_query('SELECT '.$slt.' FROM news WHERE  news_title<>"" AND file_flv<>"" AND news_type="2" AND news_active="1"  ORDER BY news_dateadd DESC  LIMIT 0,6');						
					while($k=mysql_fetch_array($result)){				
						$name = $pub->CutStr($k['news_title']);
						$link = ''.PATH_HTTP.'VideoDetail/'.$k['parent_id'].'/'.$k['news_id'].'/'.$name.'.html';
						$show .='<tr  onmouseover=\'ew_MouseOver(this);\' onmouseout=\'ew_MouseOut(this);\' onclick=\'ew_Click(this);\'><td heigh="22" style="padding-left:2px; padding-right:2px;">
								<a href="'.$link.'" title="'.$k['news_title'].'" class="linknews">&nbsp;&raquo;&nbsp;'.$k['news_title'].'</a></td></tr>
								<tr><td  background="'.PATH_HTTP.'image/line_width.gif" height="2"></td></tr>								
								';
								
					}			
		return $show;
	}			
	function GetVideoList($cat_id,$sub_id){		
	 global $sql,$pub,$news;
			$arr_news = array();	
			$show = '';
			$curpg = isset($_REQUEST['curpg']) ? $_REQUEST['curpg'] : 1;
			$slt = "news_id, parent_id,sub_id, news_dateadd, news_title, news_content,news_smallimg ";
			if($sub_id!=""){
				$sql->query('SELECT '.$slt.' FROM news  WHERE parent_id="'.$cat_id.'" AND sub_id="'.$sub_id.'" AND file_flv<>"" AND news_type="2" AND news_active="1"   ORDER BY news_dateadd DESC  ');												
			}else{
				$sql->query('SELECT '.$slt.' FROM news  WHERE parent_id="'.$cat_id.'"  AND file_flv<>"" AND news_type="2"  AND news_active="1"   ORDER BY news_dateadd DESC  ');															
			}
			$rows_news = $sql->num_rows();
			$show = '<DIV>';
			if($rows_news>0){
					$show .= '<br /><form name="frm_page" method="post" action="'.$_SERVER['REQUEST_URI'].'">
					<input type="hidden" name="curpg" value="'.$curpg.'">';
					
					$i_view 	= 0;
					$maxrow 	= 40 ;
					$maxpage 	= 4 ;
					$somautin 	= 0;
					$i 			= $rows_news;
					while($k=$sql->fetch_array()){
						if (($somautin >= ($curpg-1) * $maxrow) && ($somautin < $curpg * $maxrow)){
						$name	= $pub->CutStr($k['news_title']);
						$link = ''.PATH_HTTP.'VideoDetail/'.$k['parent_id'].'/'.$k['news_id'].'/'.$name.'.html';
						$show .='<DIV>
								<TABLE width="100%" cellSpacing=2 cellPadding=2 border=0>
								  <TBODY><TR  onmouseover=\'ew_MouseOver(this);\' onmouseout=\'ew_MouseOut(this);\' onclick=\'ew_Click(this);\'>
									<TD align="left"  colspan="2" height="30"><a href="'.$link.'" class="linknews"><b> &raquo;&nbsp;'.$k["news_title"].'</b></a></TD>
								  </TR>
								  <TR><TD background="'.PATH_HTTP.'image/line_width.gif" height="2" colspan="2" ></TD></TR>			  
								  </TBODY>
								 </TABLE></DIV>';

						}	
						$i--;
						$somautin ++ ;		
					}
					$show.='<DIV align="center">'.$pub->paging_java2("paging",$rows_news,$curpg,$maxpage,$maxrow).'</DIV>';					
			}else{
					$show .= '<DIV align="center">&nbsp;'.NOTDATA.'</DIV>';
			}				
			$show .= '</form></DIV>';
		$sql->free_result();			
		return $show;			
	}	
			
	
	function Show_FLV($ID,$type,$file,$width,$height){
		if($type=="1"){
			$link = substr($file,0,4);
			$duoi = substr($file,-3);
			if(($link=="http")&&($duoi=="flv")){
				$str ='<p id="player'.$ID.'" align="center"></p>';
							$str .='<script type="text/javascript">
							var sFlashPlayer4488 = new SWFObject("'.PATH_HTTP.'player.swf","playlist","'.$width.'","'.$height.'","7");
							sFlashPlayer4488.addParam("allowfullscreen","true");
							sFlashPlayer4488.addVariable("file","'.$file.'");
							sFlashPlayer4488.addVariable("displayheight","270");
							sFlashPlayer4488.addVariable("width","'.$width.'");
							sFlashPlayer4488.addVariable("height","'.$height.'");
							sFlashPlayer4488.addVariable("backcolor","0x000000");
							sFlashPlayer4488.addVariable("frontcolor","0xCCCCCC");
							sFlashPlayer4488.addVariable("lightcolor","0x557711");
							sFlashPlayer4488.addVariable("shuffle","true");
							sFlashPlayer4488.addVariable("repeat","list");
							sFlashPlayer4488.write("player'.$ID.'");
						</script>';	
				}
			if(($link!="http")&&($duoi=="flv")){
				$str ='<p id="player'.$ID.'" align="center"></p>';
							$str .='<script type="text/javascript">
							var sFlashPlayer4488 = new SWFObject("'.PATH_HTTP.'player.swf","playlist","'.$width.'","'.$height.'","7");
							sFlashPlayer4488.addParam("allowfullscreen","true");
							sFlashPlayer4488.addVariable("file","'.PATH_HTTP.'upload_img/flv/'.$file.'");
							sFlashPlayer4488.addVariable("displayheight","270");
							sFlashPlayer4488.addVariable("width","'.$width.'");
							sFlashPlayer4488.addVariable("height","'.$height.'");
							sFlashPlayer4488.addVariable("backcolor","0x000000");
							sFlashPlayer4488.addVariable("frontcolor","0xCCCCCC");
							sFlashPlayer4488.addVariable("lightcolor","0x557711");
							sFlashPlayer4488.addVariable("shuffle","true");
							sFlashPlayer4488.addVariable("repeat","list");
							sFlashPlayer4488.write("player'.$ID.'");
						</script>';	
				}				
			if(($link=="http")&&($duoi=="wmv")||($duoi=="WMV")||($duoi=="avi")){
			$str ='<OBJECT type="application/x-oleobject" CLASSID="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" width="500" height="350">
			<param name="url" value="'.$file.'">
			<PARAM name="EnableContextMenu" value=0>
			<param NAME=volume VALUE=100>
			<param name="rate" value="1">
			<param name="balance" value="0">
			<param name="currentPosition" value="0">

			<param name="defaultFrame" value>
			<param name="playCount" value="1">
			<param name="autoStart" value="-1">
			<param name="currentMarker" value="0">
			<param name="invokeURLs" value="-1">
			<param name="baseURL" value>
			<param name="mute" value="0">
			<param name="uiMode" value="full">
			<param name="stretchToFit" value="-1">

			<param name="windowlessVideo" value="0">
			<param name="enabled" value="-1">
			<param name="fullScreen" value="0">
			<param name="SAMIStyle" value>
			<param name="SAMILang" value>
			<param name="SAMIFilename" value>
			<param name="captioningID" value>
			<param name="enableErrorDialogs" value="0">
			<EMBED type="application/x-mplayer2" quality=high pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" file="'.$file.'" src="'.$file.'" WIDTH="500" height="350"  AutoStart="1" EnableContextMenu="0" Mute="0" ShowStatusBar="1">
			</OBJECT>';	
				}				
		}if($type=="2"){
				$str ='<object width="500" height="350">
				<param name="movie" value="http://www.youtube.com/v/'.$file.'&hl=en_US&fs=1&"></param>
				<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>
				<embed src="http://www.youtube.com/v/'.$file.'&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="350">
				</embed>
				</object>';
		
		}if($type=="0"){
			$str = 'Video not found';
		}
			return $str;
	}		
		function ShowHotVideoImg(){
		global $sql,$pub;
		$show = '';
		$slt    = "*";	

		$sql->query("SELECT ".$slt." FROM news WHERE file_flv<>'' AND news_smallimg<>'' AND news_hot='1'   ORDER BY news_dateadd DESC  LIMIT 0,4");						

		while ($k=$sql->fetch_array($result)) {				
						$name	= $pub->CutStr($k['news_title']);
						$link = ''.PATH_HTTP.'VideoDetail/'.$k['parent_id'].'/'.$k['news_id'].'/'.$name.'.html';

				$show .='<a href="'.$link.'"><img src="'.PATH_HTTP.'upload_img/small_img/'.$k['news_smallimg'].'" width="100px" height="100" vspace="3" hspace="3" border="0" title="'.$k['img_title'].'"></a>&nbsp;';										
				
		}						
			
		$sql->free_result();
		return $show;		
	}	
	function GetCompanyList($sub_id){		
	 global $sql,$pub,$news;
			$arr_news = array();	
			$show = '';
			$curpg = isset($_REQUEST['curpg']) ? $_REQUEST['curpg'] : 1;
			$slt = "*";
			
				$sql->query('SELECT '.$slt.' FROM company WHERE sub_id="'.$sub_id.'" ORDER BY c_dateopen DESC  ');												
			
			
			$rows_news = $sql->num_rows();
			$show = '<DIV>';
			if($rows_news>0){
					$show .= '<br /><form name="frm_page" method="post" action="'.$_SERVER['REQUEST_URI'].'">
					<input type="hidden" name="curpg" value="'.$curpg.'">';
					
					$i_view 	= 0;
					$maxrow 	= 10 ;
					$maxpage 	= 6 ;
					$somautin 	= 0;
					$i 			= $rows_news;
					while($k=$sql->fetch_array()){
						if (($somautin >= ($curpg-1) * $maxrow) && ($somautin < $curpg * $maxrow)){
						$name	= $pub->CutStr($k['c_name']);
						$link = ''.PATH_HTTP.'Doanh-nghiep-BDS/'.$k['sub_id'].'/'.$k['c_id'].'/'.$name.'.html';
						$show .='<DIV>
								<TABLE width="95%" cellSpacing=2 cellPadding=2 border=0>
								  <TBODY>';
								  if($k["c_name"]!=""){
								  $show.='<TR>
									<TD align="left"  colspan="2" height="30"><a href="'.$link.'" class="linknews"><b> &raquo;&nbsp;'.$k["c_name"].'</b></a></TD>
								  </TR>';
								  }													
								  if($k['logo']!=""){
									  $show .= '<TR >
											<td  width="100" height="100" align="center"><img src="'.PATH_HTTP.'upload_img/'.$k['logo'].'" vspace="1" hspace="1" width="50" height="50"></td>
											<TD><div><img src="'.PATH_HTTP.'image/phone.gif">'.$k['c_tel'].'</div><br>
											<div><img src="'.PATH_HTTP.'image/ico_print.gif">'.$k['c_fax'].'</div><br>
											<div>'.$k['c_website'].'</div><br></TD>
										  </TR>';	
									}else{
									  $show .= '<TR >
											<TD  colspan="2"><div><img src="'.PATH_HTTP.'image/phone.gif">'.$k['c_tel'].'</div><br>
											<div><img src="'.PATH_HTTP.'image/ico_print.gif">'.$k['c_fax'].'</div><br>
											<div>'.$k['c_website'].'</div><br>
											</TD>
										  </TR>';										
									}										

								  $show .='<TR><TD background="'.PATH_HTTP.'image/line_width.gif" height="2" colspan="2" ></TD></TR>			  
								  </TBODY>
								 </TABLE></DIV>';

						}	
						$i--;
						$somautin ++ ;		
					}
					$show.='<DIV align="center">'.$pub->paging_java2("paging",$rows_news,$curpg,$maxpage,$maxrow).'</DIV>';					
			}else{
					$show .= '<DIV align="center">&nbsp;Not Result</DIV>';
			}				
			$show .= '</form></DIV>';
		$sql->free_result();			
		return $show;			
	}
	
};

?>